function [ mse ] = MSE( rPortfolio, rIndex, beta)
%MSE Summary of this function goes here
%   Detailed explanation goes here
    [m n] = size(rPortfolio);
    if (length(beta)==1)
        for i=1:n
            mse = sum((rPortfolio(:,i) - rIndex*beta).^2)/m; 
        end
    else
        for i=1:n
            mse = sum((rPortfolio(:,i) - rIndex(i)*beta(i)).^2)/m; 
        end
    end
    
end

